import { UiManager } from "../manager/ui_manager";
import Store from "../store/store";

const { ccclass, property } = cc._decorator;

@ccclass
export default class GameController extends cc.Component {
  onLoad() {
    cc.resources.load("prefab/dialog", (err, asset) => {
      if (err) throw new Error("prefab/dialog加载失败：" + JSON.stringify(err));
      Store.dialogAsset = asset;
    });
  }

  start() {}

  async openDialog() {
    Store.dialog = cc.instantiate(Store.dialogAsset) as any;
    Store.dialog.parent = this.node;
    await UiManager.showDialog(Store.dialog);
    console.log("对话框开启");
  }

  // update (dt) {}
}
